﻿using System;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using System.Linq;

namespace SeriesUtil.SeriesClasses
{
    public class Series
    {
        private String name;
        private Boolean absolute;
        private List<Season> seasons;
        private List<Episode> episodes;
        //private DirectoryInfo di;

        public Series(String name, Boolean absolute, List<Season> seasons, List<Episode> episodes)
        {
            this.absolute = absolute;
            this.name = name;
            this.seasons = seasons;
            // TODO: read from seasons...
            this.episodes = episodes;
        }

        public Series(String name, Boolean absolute, List<Episode> episodes)
        {
            this.absolute = absolute;
            this.name = name;
            this.seasons = null;
            this.episodes = episodes;
        }

        public String Name
        {
            get { return name; }
            set { this.name = value; }
        }

        public Boolean Absolute
        {
            get { return absolute; }
            set { this.absolute = value; }
        }

        public List<Season> Seasons
        {
            get { return seasons; }
            set { this.seasons = value; }
        }

        public List<Episode> Episodes
        {
            get { return episodes; }
            set { this.episodes = value; }
        }

        /* TODO: move out of here...
        private List<Season> SeasonList(DirectoryInfo di, Boolean absolute)
        {
            if (!absolute)
            {
                // get the List of Seasons...
            }
            return seasons;
        }

        private List<Episode> EpisodeList(DirectoryInfo di)
        {
            episodes = new List<Episode>();
            IEnumerable<FileInfo> files = di.EnumerateFiles();
            foreach (var file in files.Where(f => Episode.extensions.Contains(f.Extension)))
            {
                episodes.Add(new Episode(file.FullName));
            }
            return episodes;
        }
         * */
    }
}
